// swagger 2.0
export interface SwaggerDocSnd {
  swagger?: string
  openapi?: string
  info: {
    description: string
    version: string
    title: string
  }
  tags: Tags[]
  host: string
  basePath: string
  paths: Paths
  definitions: Definitions
}

// swagger3
export interface SwaggerDocTnd {
  swagger?: string
  openapi?: string
  tags: Tags[]
  info: {
    description: string
    version: string
    title: string
  }
  host: string
  basePath: string
  paths: PathsTnd
  components: {
    schemas: Definitions
  }
}
export interface Tags {
  name: string
}
// 请求路径集合
export interface Paths {
  [path: string]: PathsItem
}
export interface PathsTnd {
  [path: string]: PathsItemTnd
}
export interface PathsItemTnd {
  [method: string]: {
    tags: string[]
    requestBody: RequestBody
    summary: string
    consumes: string[]
    responses: ResponsesTnd
  }
}
export interface RequestBody {
  content: {
    [key: string]: {
      schema: SchemaType
    }
  }
}
export interface ResponsesTnd {
  [key: string]: {
    descriptio: string
    content: {
      [key: string]: {
        schema: SchemaType
      }
    }
  }
}
export interface PathsItem {
  [method: string]: {
    tags: string[] // 归属于哪个接口
    summary: string // 描述
    parameters?: Parameters[] // 传参值
    responses: ResType // 相应值
  }
}

export interface Parameters {
  in: string // 入参
  name: string // 名字
  description: string // 描述
  required: boolean // 是否必需带参
  schema: SchemaType
  type: string
}
// 类型指向
export interface SchemaType {
  $ref?: string
  type?: string
  items?: SchemaType
}
export interface ResType {
  [code: string]: {
    description: string
    schema: SchemaType
  }
}

export interface Definitions {
  [defineName: string]: DefineName
}

export interface DefineName {
  type: string // 类型
  properties: {
    [prop: string]: VoProp
  }
}

export interface VoProp {
  type: string
  description: string
  items?: SchemaType
  $ref?: string
}

export interface Components {
  schemas: {
    [vo: string]: Definitions
  }
}

export enum DataType {
  Array = 'array',
  String = 'string',
  Number = 'integer',
  Boolen = 'boolen',
  File = 'file'
}

export enum ContentType {
  json = 'application/json',
  file = 'multipart/form-data'
}

export interface UsePaths {
  url: string // 请求地址
  method: string // 请求方法
  tags: string // 标签
  summary: string // 描述
  params?: string // 参数的表示(1-$ref值， 数组$ref[], formdata的key值, 普通值)
  response?: string
  required: boolean
}
